
package edu.tongji.jiaowu.dao.jdbc;
 
import java.util.List;

import edu.tongji.jiaowu.dao.CodeCategoryDao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class CodeCategoryDaoJdbc extends BaseDaoJdbc implements CodeCategoryDao {
	String tableName="T_CODE_CATEGORY";
	String beanName="codeCategory";
	
	public CommonBean createCodeCategory(){
		CommonBean codeCategorys=this.createBean(tableName,beanName);
                return codeCategorys;		
	}
	
/*
	public CommonBean findCodeCategorys(String refid) {
		CommonBean codeCategorys=this.createCodeCategory();
		String sql="select * from T_CODE_CATEGORY where refid=?";
		List data=this.getCommonDao().select(sql,new String[]{refid});
		codeCategorys.addData(data);
                return codeCategorys;
       }
*/
	public CommonBean findCodeCategoryById(String id) {
		CommonBean codeCategorys=this.createCodeCategory();
		String sql="select * from T_CODE_CATEGORY where id=?";
		List data=this.getCommonDao().select(sql,new String[]{id});
		codeCategorys.addData(data);
    return codeCategorys;
  }
  
	public CommonBean findAllCodeCategorys() {
		CommonBean codeCategorys=this.createCodeCategory();
		String sql="select * from T_CODE_CATEGORY ";
		List data=this.getCommonDao().select(sql,new String[]{});
		codeCategorys.addData(data);
    return codeCategorys;
  }
	public void insertCodeCategory(CommonBean codeCategoryBean){
		List data=codeCategoryBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row,data,this.getIdGenerator());
	}
}

